package com.lr.app.config;

import java.io.File;
import java.io.IOException;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.system.ApplicationHome;

@ConfigurationProperties(prefix = "exstorage")
public class ExStorageConfig {

	private String value;
	private static String excelTempFolder;

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public static String getExcelTempFolder() {
		return excelTempFolder;
	}

	public  void setExcelTempFolder(String excelTempFolder) throws IOException {
		if(value==null||value.length()==0){
			ApplicationHome home = new ApplicationHome(getClass());
			File jarFile = home.getSource().getParentFile();
			value=jarFile.getCanonicalPath()+"/exstorage/";
		}
		ExStorageConfig.excelTempFolder = value+excelTempFolder;
		System.out.println("====================初始化资源存储目录，路径："+ExStorageConfig.excelTempFolder);
	}


}
